Back to course home
0% completed
Vote For New Content
Google Hard
Shortest Subarray with Sum at Least K (hard)
Solution: Shortest Subarray with Sum at Least K
Reverse Pairs (hard)
Solution: Reverse Pairs
Nth Magical Number (hard)
Solution: Nth Magical Number
Candy (hard)
Solution: Candy
Arithmetic Slices II - Subsequence (hard)
Solution: Arithmetic Slices II - Subsequence
Burst Balloons (hard)
Solution: Burst Balloons
Sum of Distances in Tree (hard)
Solution: Sum of Distances in Tree
Maximum Score of a Good Subarray (hard)
Solution: Maximum Score of a Good Subarray
Trapping Rain Water (hard)
Solution: Trapping Rain Water
First Missing Positive (hard)
Solution: First Missing Positive
Meeting Rooms II (medium)
Problem Statement
Given an array of meeting intervals where intervals[i] = [starti, endi], return the minimum number of meeting rooms needed so that no meetings overlap.
Examples
Example 1:
- Input: intervals =
[[10, 15], [20, 25], [30, 35]] - Expected Output:
1 - Justification: There are no overlapping intervals in the given list. So, only 1 meeting room is enough for all the meetings.
Example 2:
- Input: intervals =
[[10, 20], [15, 25], [24, 30], [5, 14], [22, 28], [1, 4], [27, 35]] - Expected Output:
3 - Justification:
Let's see how many meetings overlap at the same time:
- [1, 4] starts first.
- Then [5, 14] begins, no overlap yet.
- [10, 20] overlaps with [5, 14]
- [15, 25] overlaps with [10, 20]
- [22, 28] overlaps with [15, 25]
- [24, 30] overlaps with both [22, 28] and [15, 25]
- [27, 35] overlaps with [24, 30]
Example 3:
- Input: intervals =
[[10, 20], [20, 30]] - Expected Output:
1 - Justification: The end time of the first meeting is the same as the start time of the second meeting. So, one meeting can be scheduled right after the other in the same room.
Constraints:
- 1 <= intervals.length <= 104
- 0 <= starti < endi <= 106
Try it yourself
Try solving this question here:
Java
Saved to Cloud
. . . .
Solution: Container With Most Water
Solution: Meeting Rooms II
Mark as Completed
On this page
Problem Statement
Examples
Try it yourself